import Main;
import nme.Assets;


class ApplicationMain {
	
	static var mPreloader:NMEPreloader;

	public static function main () {
		
		var call_real = true;
		
		
		var loaded:Int = nme.Lib.current.loaderInfo.bytesLoaded;
		var total:Int = nme.Lib.current.loaderInfo.bytesTotal;
		
		if (loaded < total || true) /* Always wait for event */ {
			
			call_real = false;
			mPreloader = new NMEPreloader();
			nme.Lib.current.addChild(mPreloader);
			mPreloader.onInit();
			mPreloader.onUpdate(loaded,total);
			nme.Lib.current.addEventListener (nme.events.Event.ENTER_FRAME, onEnter);
			
		}
		
		
		if (call_real)
			Main.main();
	}

	static function onEnter (_) {
		
		var loaded:Int = nme.Lib.current.loaderInfo.bytesLoaded;
		var total:Int = nme.Lib.current.loaderInfo.bytesTotal;
		mPreloader.onUpdate(loaded,total);
		
		if (loaded >= total) {
			
			mPreloader.onLoaded();
			nme.Lib.current.removeEventListener(nme.events.Event.ENTER_FRAME, onEnter);
			nme.Lib.current.removeChild(mPreloader);
			mPreloader = null;
			
			Main.main ();
			
		}
		
	}

	public static function getAsset (inName:String):Dynamic {
		
		
		if (inName=="assets/NO.png")
			 
            return Assets.getBitmapData ("assets/NO.png");
         
		
		if (inName=="assets/ResetSavedData.png")
			 
            return Assets.getBitmapData ("assets/ResetSavedData.png");
         
		
		if (inName=="assets/Credits.png")
			 
            return Assets.getBitmapData ("assets/Credits.png");
         
		
		if (inName=="assets/MainMenu.png")
			 
            return Assets.getBitmapData ("assets/MainMenu.png");
         
		
		if (inName=="assets/audioMute.png")
			 
            return Assets.getBitmapData ("assets/audioMute.png");
         
		
		if (inName=="assets/Background.mp3")
			 
            return Assets.getSound ("assets/Background.mp3");
		 
		
		if (inName=="assets/Yes.png")
			 
            return Assets.getBitmapData ("assets/Yes.png");
         
		
		if (inName=="assets/BLAAMMute.png")
			 
            return Assets.getBitmapData ("assets/BLAAMMute.png");
         
		
		if (inName=="assets/Options.png")
			 
            return Assets.getBitmapData ("assets/Options.png");
         
		
		if (inName=="assets/StartButton.png")
			 
            return Assets.getBitmapData ("assets/StartButton.png");
         
		
		if (inName=="assets/Back.png")
			 
            return Assets.getBitmapData ("assets/Back.png");
         
		
		if (inName=="assets/audio.png")
			 
            return Assets.getBitmapData ("assets/audio.png");
         
		
		if (inName=="assets/Menu.png")
			 
            return Assets.getBitmapData ("assets/Menu.png");
         
		
		if (inName=="assets/button.png")
			 
            return Assets.getBitmapData ("assets/button.png");
         
		
		if (inName=="assets/TextBackground.png")
			 
            return Assets.getBitmapData ("assets/TextBackground.png");
         
		
		if (inName=="assets/Background.png")
			 
            return Assets.getBitmapData ("assets/Background.png");
         
		
		if (inName=="assets/ContinueGame.png")
			 
            return Assets.getBitmapData ("assets/ContinueGame.png");
         
		
		if (inName=="assets/icon.png")
			 
            return Assets.getBitmapData ("assets/icon.png");
         
		
		if (inName=="assets/Instructions.png")
			 
            return Assets.getBitmapData ("assets/Instructions.png");
         
		
		if (inName=="assets/CircleBackground.png")
			 
            return Assets.getBitmapData ("assets/CircleBackground.png");
         
		
		if (inName=="assets/BLAAM.png")
			 
            return Assets.getBitmapData ("assets/BLAAM.png");
         
		
		
		return null;
		
	}
	
}



	
		class NME_assets_no_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_resetsaveddata_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_credits_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_mainmenu_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_audiomute_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_background_mp3 extends nme.media.Sound { }
	

	
		class NME_assets_yes_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_blaammute_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_options_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_startbutton_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_back_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_audio_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_menu_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_button_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_textbackground_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_background_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_continuegame_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_icon_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_instructions_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_circlebackground_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	

	
		class NME_assets_blaam_png extends nme.display.BitmapData { public function new () { super (0, 0); } }
	
